//
//  MainLeftView.m
//  IpadTestB
//
//  Created by edianzu on 2017/6/27.
//  Copyright © 2017年 ruilai. All rights reserved.
//

#import "MainLeftView.h"

@implementation MainLeftView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self creatUI];
    }
    return self;
}

-(void)creatUI{
    self.backgroundColor = UIColorFromRGB(31, 36, 48);
    
    _iconIMG = [[UIImageView alloc]init];
    _iconIMG.image = [UIImage imageNamed:@"iconLeft"];
    [self addSubview:_iconIMG];
    [_iconIMG mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.mas_centerX);
        make.top.mas_equalTo(self.mas_top).with.offset(40*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(60*AutoScaleHorizontal, 60*AutoScaleVertical));
    }];
    
    _iconLabel = [[UILabel alloc]init];
    _iconLabel.text = @"嘟嘟熊乐园";
    _iconLabel.textColor = [UIColor whiteColor];
    [_iconLabel setTextAlignment:NSTextAlignmentCenter];
    _iconLabel.font = [UIFont boldSystemFontOfSize:23*AutoScaleHorizontal];
    [self addSubview:_iconLabel];
    [_iconLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.mas_centerX);
        make.top.mas_equalTo(_iconIMG.mas_bottom).with.offset(20*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(300 *AutoScaleHorizontal, 34*AutoScaleVertical));
    }];
    
    _offBTN = [UIButton buttonWithType:UIButtonTypeCustom];
    [_offBTN setBackgroundImage:[UIImage imageNamed:@"offLeft"] forState:UIControlStateNormal];
    [self addSubview:_offBTN];
    [_offBTN mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top).with.offset(15*AutoScaleVertical);
        make.left.mas_equalTo(self.mas_right).with.offset(-22*AutoScaleHorizontal);
        make.size.mas_equalTo(CGSizeMake(45*AutoScaleHorizontal, 45*AutoScaleVertical));
    }];
    
    //三个按钮
    _reloadBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_reloadBtn setImage:[UIImage imageNamed:@"reloadDataBtn"] forState:UIControlStateNormal];
    _reloadBtn.imageEdgeInsets = UIEdgeInsetsMake(10*AutoScaleVertical,-100*AutoScaleHorizontal,10*AutoScaleVertical,0);
    [_reloadBtn setTitle:@"同步数据" forState:UIControlStateNormal];
    _reloadBtn.titleLabel.font = [UIFont boldSystemFontOfSize:23*AutoScaleHorizontal];
    [_reloadBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self addSubview:_reloadBtn];
    [_reloadBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.iconLabel.mas_bottom).with.offset(100*AutoScaleVertical);
        make.left.right.mas_equalTo(self);
        make.height.mas_equalTo(100*AutoScaleVertical);
    }];
    
    self.line1 = [[UIView alloc]init];
    self.line1.backgroundColor = UIColorFromRGB(40, 43, 48);
    [self addSubview:self.line1];
    [self.line1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_reloadBtn.mas_bottom);
        make.left.mas_equalTo(self.mas_left).with.offset(20*AutoScaleHorizontal);
        make.right.mas_equalTo(self.mas_right).with.offset(-20*AutoScaleHorizontal);
        make.height.mas_equalTo(1);
    }];
    
    _problemLoadBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_problemLoadBtn setImage:[UIImage imageNamed:@"problemLoadBtn"] forState:UIControlStateNormal];
    _problemLoadBtn.imageEdgeInsets = UIEdgeInsetsMake(0,-100*AutoScaleHorizontal,0,0);
    [_problemLoadBtn setTitle:@"问题上传" forState:UIControlStateNormal];
    _problemLoadBtn.titleLabel.font = [UIFont boldSystemFontOfSize:23*AutoScaleHorizontal];
    [_problemLoadBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self addSubview:_problemLoadBtn];
    [_problemLoadBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_reloadBtn.mas_bottom);
        make.left.right.mas_equalTo(self);
        make.height.mas_equalTo(100*AutoScaleVertical);
    }];
    self.line2 = [[UIView alloc]init];
    self.line2.backgroundColor = UIColorFromRGB(40, 43, 48);
    [self addSubview:self.line2];
    [self.line2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_problemLoadBtn.mas_bottom);
        make.left.mas_equalTo(self.mas_left).with.offset(20*AutoScaleHorizontal);
        make.right.mas_equalTo(self.mas_right).with.offset(-20*AutoScaleHorizontal);
        make.height.mas_equalTo(1);
    }];
    
    
    
    _quitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_quitBtn setImage:[UIImage imageNamed:@"quitBtn"] forState:UIControlStateNormal];
    _quitBtn.imageEdgeInsets = UIEdgeInsetsMake(0,-100*AutoScaleHorizontal,0,0);
    [_quitBtn setTitle:@"退出登录" forState:UIControlStateNormal];
    _quitBtn.titleLabel.font = [UIFont boldSystemFontOfSize:23*AutoScaleHorizontal];
    [_quitBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self addSubview:_quitBtn];
    [_quitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.mas_bottom);
        make.left.right.mas_equalTo(self);
        make.height.mas_equalTo(100*AutoScaleVertical);
    }];
    self.line3 = [[UIView alloc]init];
    self.line3.backgroundColor = UIColorFromRGB(40, 43, 48);
    [self addSubview:self.line3];
    [self.line3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(_quitBtn.mas_top);
        make.left.mas_equalTo(self.mas_left).with.offset(20*AutoScaleHorizontal);
        make.right.mas_equalTo(self.mas_right).with.offset(-20*AutoScaleHorizontal);
        make.height.mas_equalTo(1);
    }];
}
@end
